<template>
	<view class="archives">
		<view class="header-bg">
			<!-- <u-navbar :is-back="true" :custom-back="customBack" title="我的二维码" :border-bottom="false"	 :background="background"></u-navbar> -->
			<view class="h-me ">
				<view class="me-1 flex-box">
					<view class="left">
						<image :src="userInfo.headimg" class="head"></image>
					</view>
					<view class="right">
						<view class="hd">{{userInfo.nickname}}</view>
						<view class="desc">你好，欢迎来到伊姿漾</view>
					</view>
				</view>
				<view class="bm-content flex-box">
					<!-- #ifdef MP-WEIXIN -->
					<image :src="info.ewm" class="wx-code" @tap="saveImg"></image>
					<!--#endif -->
					<!-- #ifdef APP-PLUS -->
			<!-- 		<uni-qrcode ref="uniqrcode" @ltap="saveCode" :size="100" cid="qrcode01" foregroundColor="#333" 
					logo="https://static.dhlshu.cn/app/static/head.png" makeOnLoad @makeComplete="qrcodeComplete" /> -->
					<!--#endif -->
				</view>
				
			</view>
			
		</view>
	</view>
</template>

<script>
	// import app from "@/common/js/comm_url.js";
	import {
		mapState
	} from 'vuex'
	export default {
		data() {
			return {
				background:'transparent',
				infor:{},
				headimg:'',
				num:0,
				age:0,
				info:{},
				report:[],
				code:null,
				url:''
			};
		},
		computed: {
			...mapState(['hasLogin','userInfo'])
		},
		onLoad(option) {
			if(option.code){
				uni.setStorageSync('code', option.code);
			}
			this.url = this.$c.codeUrl
			this.initData()
		},
		onShareAppMessage: function() {
			 return {
				title:'你好，欢迎来到伊姿漾',
				path:'/pages/login/login?scene='+this.info.code,
				imgUrl:this.url+'?scene='+this.info.code
			 }
		},
				//分享到朋友圈
		onShareTimeline(res) {
			return {
			   title:'你好，欢迎来到伊姿漾',
			   type: 0,
			   query:'scene='+this.info.code,
			   path:'/pages/login/login?scene='+this.info.code,
			   imgUrl:this.url+'?scene='+this.info.code
			}
		},
		methods:{
			customBack(){
				this.$f.jump('/pages/foot/member',4)
			},
			initData(){
				this.$u.api.inviteCode()
				.then(res=>{
					this.info = res.msg
					uni.setStorageSync('code', res.msg.code);
					// #ifdef APP-PLUS
					this.$refs.uniqrcode.make(this.info.link);
					//#endif
				})
				.catch(err=>{
					console.log(err);
				})
			},
			
		}
	}
</script>

<style lang="scss">
	@import 'invite.scss';
</style>
